package com.week1.day02;

import java.util.Random;
import java.util.Scanner;

public class Demo06_homework {
    public static void main(String[] args) {
        Random random = new Random();
        int target = random.nextInt(8001)+2000;
        System.out.println("请输入2000~10000的数字" + target);
        Scanner scanner = new Scanner(System.in);
        boolean flag = false;
        for (int i = 0; i < 5; i++) {
            int guess = scanner.nextInt();
            if (guess == target) {
                flag = true;
                break;
            } else {
                System.out.println("没猜中，请继续竞猜");
            }
        }
        if (flag) {
            System.out.println("恭喜你，获得了此奖品");
        } else {
            System.out.println("很可惜，你没有获得奖品，竞猜结束");
        }
    }
}
